package com.junyang.showdata.service.impl;

import com.junyang.showdata.common.CityCountDemo;
import com.junyang.showdata.mapper.CityMapper;
import com.junyang.showdata.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @param
 * @Author fusijia
 * @Date 2025/1/15 9:35
 * @notes
 */

@Service
public class CityServiceImpl implements CityService {
    @Autowired
    private CityMapper cityMapper;

    /**
     *@notes 根据地区等级查询地区数量
     *@Author：fusijia
     *@Date：2025/1/15 9:42
     *@return：返回需要地市的数量
     */
    @Autowired
    public CityCountDemo getCityCount(){
        CityCountDemo cityCountDemo = new CityCountDemo();
        //查询对应等级地区的数量
        cityCountDemo.setTotal(cityMapper.getCityCountByLevel( -1));
        cityCountDemo.setRegionCount(cityMapper.getCityCountByLevel(1));
        cityCountDemo.setCountyCount(cityMapper.getCityCountByLevel(2));
        cityCountDemo.setPowerSupplyCount(cityMapper.getCityCountByLevel(3));
        return cityCountDemo;



    }
}